{extend name="common/base_page" /}

{block name="title"}修改个人资料信息{/block}

{block name="jscssfile"}{/block}

{block name="css"}
<style type="text/css">
.layui-form-item{
  margin-bottom:5px;margin-top:10px;
}
.layui-card { margin-bottom:0; }
</style>
{/block}

{block name="body"}
  <div class="layui-fluid">
        <div class="layui-card">
          <div class="layui-card-body">
            <form class="layui-form" action="" lay-filter="component-form-group">
              <div class="layui-row layui-col-space10 layui-form-item">
                <div class="layui-form-item">
                  <label class="layui-form-label">登录账号</label>
                  <div class="layui-input-inline">
                    <input type="text" name="user_name" lay-verify="username" autocomplete="off" class="layui-input" placeholder="8到15位系统登录账号" value="{$admin.user_name}"/>
                  </div>
                </div>
                <div class="layui-form-item">
                  <label class="layui-form-label">姓名</label>
                  <div class="layui-input-inline">
                    <input type="text" name="nickname" lay-verify="nickname" autocomplete="off" maxlength="5" placeholder="填写真实姓名" class="layui-input" value="{$admin.nickname}"/>
                  </div>
                </div>
                <div class="layui-form-item">
                  <label class="layui-form-label">性别</label>
                  <div class="layui-input-block">
                    <input type="radio" name="sex" value="1" title="男" {if $admin.sex eq '1'}checked="true"{/if}>
                    <input type="radio" name="sex" value="2" title="女" {if $admin.sex eq '2'}checked="true"{/if}>
                    <input type="radio" name="sex" value="0" title="未知" {if $admin.sex eq '0'}checked="true"{/if}>
                  </div>
                </div>
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="component-form-demo1">保存</button>
                  <button type="reset" class="layui-btn layui-btn-primary" onclick="window.parent._Index.closedialogLayer();">关闭</button>
                  <button class="layui-btn layui-btn-primary" onclick="window.parent.layui.index.openTabsPage('{:url('index/clinic.admin/info')}?id={$admin.id}','修改个人资料');window.parent._Index.closedialogLayer();">更多...</button>
                </div>
              </div>
            </form>
          </div>
  </div>
</div>
{/block}

{block name="script"}
<script type="text/javascript">
$(function(){
  setTimeout(function(){
     
  },100);
});

layui.use(['form'], function(){
    form = layui.form;
    form.render(null, 'component-form-group');
    /* 自定义验证规则 */
    form.verify({
      username: [/(.+){8,15}$/, '必须填写8到15位登录账号']
      ,nickname: function(value){
        if(value.length <= 1){
          return '必须填写人员真实姓名';
        }
      }
    });
    /* 监听提交 */
    form.on('submit(component-form-demo1)', function(data){
      console.log(JSON.stringify(data.field)); //最终的提交信息
      layer.confirm('确定要保存个人资料信息吗？', {
          title:'保存',shade:[0.4,'#000000'],btn: ['确定','取消'],
          btn1:function(){
              layer.closeAll();
              _Index.ajax("{:url('index/clinic.admin/edit_myself')}",data.field,function(d){
                if(d.err == 0)
                {
                  layer.msg(d.msg, {time: 1000},function(){ 
                    window.parent._Index.closedialogLayer();
                  });
                }else{
                  layer.msg(d.msg, {time: 2000,anim: 4});
                }
              },'请稍候...');
          }
      });
      return false;
    });
  });
</script>
{/block}